//index.js
const app = getApp()

Page({
  data: {
    name:'',
    avatarUrl: './user-unlogin.png',
    userInfo: {},
    logged: false,
    takeSession: false,
    requestResult: ''
  },

  onLoad(){
    const db = wx.cloud.database()
    console.log('ok')
    let res=db.collection('demo').get({
      
      success: (res)=> {
        // res.data 是一个包含集合中有权限访问的所有记录的数据，不超过 20 条
        console.log(res.data[0].name)
        this.setData({name:res.data[0].name})

      },
      fail(res){
        console.log(res)
      }
    })
    
  }

})
